package com.mo.sys.dao.Impl;

import com.mo.sys.dao.SysNoticeDao;
import com.mo.sys.pojo.SysNotice;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

//@Component
public class SysNoticesDaoImpl implements SysNoticeDao {

   @Autowired
    private SqlSession sqlSession;//注入工厂


    @Override
    public List<SysNotice> selectNotices(SysNotice notice) {

     //   String statement="com.mo.sys.pojo.SysNoticeDao.selectNotices";
    //        List<SysNotice> list=sqlSession.selectList(statement,notice );

    //    SysNoticeDao noticeDao=sqlSession.getMapper(SysNoticeDao.class);
      //   List list=noticeDao.selectNotices(notice);
       // return list;

        String namespace=this.getClass().getInterfaces()[0].getName();
        //获取当前线程的方法栈，并取到当前方法的名字
        String elementId=Thread.currentThread().getStackTrace()[1].getMethodName();
        String statement=namespace+"."+elementId;
       List<SysNotice>list=sqlSession.selectList(statement, notice);
         return list;

    }

    @Override
    public int deleteById(Long... id) {
        return 0;
    }

    @Override
    public int insertNotices(SysNotice notice) {
        return 0;
    }

    @Override
    public SysNotice findById(Long id) {
        return null;
    }

    @Override
    public int updateNotices(SysNotice notice) {
        return 0;
    }
}
